﻿using System.Collections;
using System.Collections.Generic;
using YanZhiwei.DotNet2.Utilities.Models;

namespace YanZhiwei.DotNet2.Utilities.Base
{
    ///// <summary>
    ///// 地图纠偏比较类
    ///// </summary>
    public class MapOffsetComparer : IComparer
    {
        /// <summary>
        /// Compare
        /// </summary>
        /// <param name="x">object</param>
        /// <param name="y">object</param>
        /// <returns></returns>
        public int Compare(object x, object y)
        {
            MapCoord _coord1 = (MapCoord)x, _coord2 = (MapCoord)y;
            int _dlng = _coord1.Lon - _coord2.Lon;
            if (_dlng != 0)
                return _dlng;
            else
                return _coord1.Lat - _coord2.Lat;
        }
    }
    //public class MapOffsetComparer : IComparer<MapCoord>
    //{
    //    public int Compare(MapCoord x, MapCoord y)
    //    {
    //        int _dlng = x.lng - y.lng;
    //        if (_dlng != 0)
    //            return _dlng;
    //        else
    //            return x.lat - x.lat;
    //    }
    //}
}
